function [ x,e ,w1,w2] = PollefeyVisualwithPOLDTWOFRAMEFAM2debug( F,w,h,typicalF )
%code conforms to the marr prize paper but with full parametrization of the
%Q so we solve for the 10 variables
%UNTITLED Summary of this function goes here
%   Detailed explanation goes here
%http://www.robots.ox.ac.uk/~vgg/hzbook/code/
%http://www.csse.uwa.edu.au/~pk/research/matlabfns/
% data:   http://www.robots.ox.ac.uk/~vgg/data/data-mview.html
f1=0;
f2=0;
x=[0 0];

%remove this
%typicalF=w+h;
G=normalizeFSturm(F,w,h,typicalF);

K_norm=eye(3,3);


P=PsfromF( G );
[m n ]=size(P);
numFrames=n;


P_in=P;



if(m>1)
    disp([ 'the size of the input cell is wrong']);
end


%now form A

[A,b]  = formAunknownF( P_in );

[QZ]=QsfromAb(A,b);



S=findSolsfromQ(QZ);

if(size(QZ,2)>1)
    Q1=QZ{1,1};
    Q2=QZ{1,2};
else
    Q1=QZ{1,1};
    Q2=zeros(4,4);
end

for i=1:size(S,1)
    QS{1,i}=normalizeSetRank(Q1+ S(i,1)*Q2);
    
end
%S

%%%%%%%%%%%%%%%%%%%%%


MS=chooseFinalQ(QS);


if(size(MS,2)==0)
    M=eye(4,4);
    
else
    
    M=MS{1,1};
    
end

w1=P_in{1}*M*(P_in{1}');
e=sqrt(w1(1,1)/w1(3,3));
w1=w1/w1(3,3);


w2=P_in{2}*M*(P_in{2}');
e=sqrt(w2(1,1)/w2(3,3));
w2=w2/w2(3,3);


% G
% P_in{1}
% P_in{2}
% M

K1=findKfromPQ(K_norm,P_in{1,1},M);
K2=findKfromPQ(K_norm,P_in{1,2},M);

f1=K1(1,1)*typicalF;
f2=K2(1,1)*typicalF;



x=[f1   f2];



end





